From: Giovanni Campagna Date: Mon, 13 Feb 2012 14:54:46 +0000 (+0100) Subject: ShellNetworkAgent: don't access request fields if the operation is cancelled X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~7050 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=c5804c19294cd0fb0e6670a6df957a95836af89c;p=gnome-shell.git ShellNetworkAgent: don't access request fields if the operation is cancelled When the operation is cancelled by NetworkManager, the request is cancelled immediately. Later when gnome-keyring invokes the callback notifying the error we must therefore not access its memory. Previously the callback would mistakenly treat "cancelled" (which indicates a programmatic cancel) as "denied" (which means the user clicked "Cancel" on the keyring prompt) https://bugzilla.gnome.org/show_bug.cgi?id=658484 --- diff --git a/src/shell-network-agent.c b/src/shell-network-agent.c index b24999b75..964023694 100644 --- a/src/shell-network-agent.c +++ b/src/shell-network-agent.c @@ -229,22 +229,29 @@ get_secrets_keyring_cb (GnomeKeyringResult result, GList *list, gpointer user_data) { - ShellAgentRequest *closure = user_data; - ShellNetworkAgent *self = closure->self; - ShellNetworkAgentPrivate *priv = self->priv; + ShellAgentRequest *closure; + ShellNetworkAgent *self; + ShellNetworkAgentPrivate *priv; GError *error = NULL; gint n_found = 0; GList *iter; GHashTable *outer; + if (result == GNOME_KEYRING_RESULT_CANCELLED) + return; + + closure = user_data; + self = closure->self; + priv = self->priv; + closure->keyring_op = NULL; - if (result == GNOME_KEYRING_RESULT_CANCELLED) + if (result == GNOME_KEYRING_RESULT_DENIED) { g_set_error (&error, NM_SECRET_AGENT_ERROR, NM_SECRET_AGENT_ERROR_USER_CANCELED, - "The secret request was cancelled by the user"); + "Access to the secret storage was denied by the user"); closure->callback (NM_SECRET_AGENT (closure->self), closure->connection, NULL, error, closure->callback_data);